Release 10.1A: OpenEdge Development:
Progress Dynamics Administration
Writing a load program
The load program is slightly more complicated than the dump program because it must verify the referential integrity of the data. The following shows a sample load program using both default and user-supplied code to import the contents of the
gsm_menu_structure_itemtable:
The
InputTablecompiler directive contains the name of the table for which data is to be imported. TheObjFieldcompiler directive specifies the field that is the object ID field for the table. TheInputFileinclude file directive specifies the name of the file to be used as the source of the data to be imported.This load program takes the
ttDumpFileLocationtable as an input parameter (sitedatahdrin.ifrom withinsitedataprocin.i), and the above default code reads that data into a temp-table that is constructedLIKEthe table being imported (sitedataprocin.i). The temp-table is namedtt_Table, whereTableis the name of the table that is being imported.Once the code in
sitedataprocin.ihas imported the code into the temp-table, a buffer to the temp-table is passed to an internal procedure calledapplyRecord. This is the only piece of code that must be customized. The header for this internal procedure is contained insiteapplyrechdr.i. By default, this code checks to see if a record exists with the object ID of the current record. If it does, the code assumes that the data has been supplied by the ADOs and that it should not be changed.The footer for the
applyRecordprocedure is contained insiteapplyrecftr.iand includes the transaction that commits the data in the temp-table to the database.You (or your end-user) supply all of the code specified between the
siteapplyrechdr.iandsiteapplyrecftr.iinclude file references. This code is responsible for verifying the referential integrity of the data being imported. If any of the integrity checks fail, control returns to the caller. This results in the main block importing the next record from the.dfile and verifying that it is correct.You can completely customize the code for the load program, as in the following example:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |